package com.wd.car.activity

import android.app.Application
import android.util.Log
import cn.jiguang.verifysdk.api.JVerificationInterface
import cn.jiguang.verifysdk.api.PreLoginListener
import com.baidu.ocr.sdk.OCR
import com.baidu.ocr.sdk.OnResultListener
import com.baidu.ocr.sdk.exception.OCRError
import com.baidu.ocr.sdk.model.AccessToken
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
import com.zzt.panorama.util.ImageUtil


/**
 * 作者:孙殿彭 by mac on2023/9/13 19:03
 * 类注释:
 */
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        ImageUtil.init(this);
        //初始化百度ocr，并且获取token
        OCR.getInstance(this).initAccessToken(object : OnResultListener<AccessToken>{
            override fun onResult(p0: AccessToken?) {

            }

            override fun onError(p0: OCRError?) {

            }

        },applicationContext)

        UMConfigure.setEncryptEnabled(true)

        // 友盟 SDK预初始化函数
        UMConfigure.preInit(this, "6506e70558a9eb5b0add9f01", "Android");

        //正是初始化
        UMConfigure.init(
            this,
            "6506e70558a9eb5b0add9f01",
            "Android",
            UMConfigure.DEVICE_TYPE_PHONE,
            ""
        )

        // 选用AUTO页面采集模式
        MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO)

        //用户卸载
        UMConfigure.submitPolicyGrantResult(applicationContext, true)

        JVerificationInterface.setDebugMode(true);
        JVerificationInterface.init(baseContext);
        sdsadas()
    }

    fun sdsadas() {
        JVerificationInterface.init(
            this
        ) { code, msg ->

            JVerificationInterface.preLogin(this, 5000, object : PreLoginListener {
                override fun onResult(p0: Int, p1: String?, p2: String?, p3: String?) {
                    Log.d("asdasdasdada", "[$p0]message=$p1")
                }
            })
            Log.d("tag", "code =" + code + "msg =" + msg)
        }
    }


}